package com.demo.rocketmq.consumer;

import com.alibaba.fastjson.JSON;
import com.demo.rocketmq.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RocketMQMessageListener(topic = "test-topic-2", consumerGroup = "test_topic_2_consumer_group")
public class TestTopic2RocketMqConsumer implements RocketMQListener<User> {

    @Override
    public void onMessage(User user) {
        log.info("received message: {}", JSON.toJSONString(user));
    }
}
